/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package samoloty.view;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import javax.swing.JLabel;
import javax.swing.SwingConstants;

/**
 *
 * @author borysfan
 */
public class MyLabel extends JLabel {

    public final static int NORMAL = 1;
    public final static int BOLD = 2;

    public MyLabel() {
        super();
        initLabel();
    }

    public MyLabel(String s) {
        super(s);
        initLabel();
    }

    public MyLabel(String s, int style) {
        super(s);
        initLabel();
        if (style == NORMAL) {
            setNormal();
        } else {
            setBold();
        }
    }

    private void initLabel() {
        setNormal();
        setGrey();
        setHorizontalAlignment(SwingConstants.CENTER);
        //  setSize(getSize().width+10, getSize().height);
    }

    public void setGrey() {
        this.setForeground(MyColors.getGrey());
    }

    public void setBold() {
        this.setFont(new Font("Tahome", Font.BOLD, 16));
    }

    public void setNormal() {
        this.setFont(new Font("Tahome", 0, 16));
    }

    public void setFont(int size) {
        this.setFont(new Font("Tahome", 2, size));
    }

    public void setPosition(Point p) {
        this.setBounds(p.x, p.y, getPreferredSize().width, getPreferredSize().height);
    }

    public void setPositionByRight(Point p) {
        this.setBounds((int) (p.x - getPreferredSize().width), p.y, getPreferredSize().width, getPreferredSize().height);
    }

    public void moveLeft(int x) {
        this.setLocation(new Point(this.getLocation().x - x, this.getLocation().y));
    }

    public void moveRight(int x) {
        this.setLocation(new Point(this.getLocation().x + x, this.getLocation().y));
    }
}
